package com.cscj.android.repository.network.api.service

import com.cscj.android.repository.network.api.ApiResponse
import com.cscj.android.repository.network.api.model.shortcut.ShortCutCategory
import com.cscj.android.repository.network.api.model.shortcut.ShortCutEntry
import retrofit2.http.Field
import retrofit2.http.FormUrlEncoded
import retrofit2.http.POST

interface ShortCutService {


    @FormUrlEncoded
    @POST("/browser/getAllModules")
    suspend fun loadAllShortCuts(@Field("none") empty:Int = 0): ApiResponse<List<ShortCutCategory>>

    @FormUrlEncoded
    @POST("/browser/getFirstPageList")
    suspend fun loadAllShortCutEntry(@Field("none") empty:Int = 0): ApiResponse<List<ShortCutEntry>>

    @FormUrlEncoded
    @POST("/browser/addUserModule")
    suspend fun addShortCut(
        @Field("moduleId") shortCutId: Int? = null, @Field("type") type: Int
    ): ApiResponse<ShortCutEntry>


    @FormUrlEncoded
    @POST("/browser/addUserModule")
    suspend fun addRootShortCut(
        @Field("type") type: Int,
        @Field("isRoot") isRoot: Int = 1
    ): ApiResponse<ShortCutEntry>


    @FormUrlEncoded
    @POST("/browser/addHistory")
    suspend fun addHistoryShortCut(
        @Field("moduleName") name: String? = null,
        @Field("link") link: String? = null,
        @Field("icon") icon: String? = null
    ): ApiResponse<ShortCutEntry>

    @FormUrlEncoded
    @POST("/browser/addBookMark")
    suspend fun addFavoriteShortCut(
        @Field("linkName") name: String? = null,
        @Field("linkUrl") link: String? = null,
        @Field("icon") icon: String? = null
    ): ApiResponse<ShortCutEntry>

    @FormUrlEncoded
    @POST("/browser/delUserModule")
    suspend fun deleteShortCut(
        @Field("id") shortCutId: Int
    ): ApiResponse<Unit>

}